package restaurant;

/**
 * Represents table items. This class contains information about a specific
 * table.
 * 
 * @author Odessa
 */

public class Table
{
	/** Constant representing initial pin value. */
	private final int INIT_PIN = 0;

	/** Constant boolean value for false. */
	private final boolean FALSE = false;

	/** Constant boolean value for true. */
	private final boolean SUCCESS = true;

	/** The capacity of this table. Default is 4. */
	final static int CAPACITY = 4;

	/** The number of this table. */
	private int tableNo;

	/** Whether or not this table is assigned. Default is {@code false}. */
	private boolean assigned = FALSE;

	/** Whether or not this table has been activated. Default is {@code false}. */
	private boolean activated = FALSE;

	/** Whether or not this table has ordered. Default is {@code false}. */
	private boolean ordered = FALSE;

	/**
	 * Whether or not the order for this table has been delivered. Default is
	 * {@code false}.
	 */
	private boolean delivered = FALSE;

	/** The pin value used to activate this table. */
	private int pin = INIT_PIN;



	/**
	 * Instantiates a new table with the default capacity.
	 * 
	 * @param tableNo the table number of this table.
	 */
	public Table(int tableNo) {
		this.tableNo = tableNo;
	}



	/**
	 * Gets the table number. The table number is used to uniquely identify each
	 * table.
	 * 
	 * @return the table number of this table.
	 */
	public int getTableNo()
	{
		return tableNo;
	}



	/**
	 * Checks if this table has been assigned.
	 * 
	 * @return {@code true} if this table is assigned.
	 */
	public boolean isAssigned()
	{
		return assigned;
	}



	/**
	 * Checks if this table has been activated.
	 * 
	 * @return {@code true} if this table was activated.
	 */
	public boolean isActivated()
	{
		return activated;
	}



	/**
	 * Checks if this table has ordered.
	 * 
	 * @return {@code true} if this table has ordered.
	 */
	public boolean hasOrdered()
	{
		return ordered;
	}



	/**
	 * Checks if this table's order was delivered.
	 * 
	 * @return {@code true} if the order was delivered.
	 */
	public boolean wasDelivered()
	{
		return delivered;
	}



	/**
	 * Gets the pin value of this table.
	 * 
	 * @return the pin associated with this table.
	 */
	public int getPin()
	{
		return pin;
	}



	/**
	 * Sets this table as being activated.
	 */
	public void setActivated()
	{
		activated = SUCCESS;
	}



	/**
	 * Sets this table as being assigned.
	 */
	public void setAssigned()
	{
		assigned = SUCCESS;
	}



	/**
	 * Sets this table as having placed an ordered.
	 */
	public void setOrdered()
	{
		ordered = SUCCESS;
	}



	/**
	 * Sets this table as having their order delivered.
	 */
	public void setDelivered()
	{
		delivered = SUCCESS;
	}



	/**
	 * Sets the pin of this table.
	 * 
	 * @param newPin the new pin value of this table.
	 */
	public void setPin(int newPin)
	{
		pin = newPin;
	}



	/**
	 * Resets this table.
	 */
	public void reset()
	{
		assigned = FALSE;
		activated = FALSE;
		ordered = FALSE;
		delivered = FALSE;
		pin = INIT_PIN;
	}
}
